import $ from 'jQuery';
(function () {
    Vue.component('demo-grid',{
        template:"#grid-template",
        props: {
            data: Array,
            columns: Array,
            total:''
        }
    });
    let storeParams = JSON.parse(IOT.getSessionStore(URI.OPERATE.SIM.DETAIL.PAGE));
    let $vue = new Vue({
        el: '.sim-detail-hook',
        data: {
        account: {
            'imsiId': '',//imsiId
            'imsiCode': '',//imsi号
            'imsiCard':'',//卡号
            'imsiPackage':'',//套餐
            'usedFlow':'',//套餐已使用流量
            'activateDate':'',//开卡时间
            'cycle':'',//计费周期（月）
            'effectiveDate':'',//套餐生效日期
            'loseDate':'',//套餐失效日期
            'flows': '',//流量合计
            'listColumns':['flowDate','flow'],//-年-月、流量（单位：KB）
            'list':[]//每月流量列表
        }
    },
        created: function () {
            IOT.getServerData(URI.OPERATE.SIM.DETAIL.DATA, {imsiCode: storeParams.imsiCode}, (ret) => {
            if (ret.code === 200) {
                this.account = $.extend({}, this.account, ret.data);
            } else {
                IOT.tips(ret.message || '服务器请求失败，稍后再试！', 'error');
            }
        });
    },
        methods: {
            goBack: function () {
                M.Page.emitPrePage();
            },
            updateData:function () {/*更新数据按钮*/
                IOT.getServerData(URI.OPERATE.SIM.DETAIL.DATA, {imsiCode: storeParams.imsiCode}, (ret) => {
                    if (ret.code === 200) {
                        this.account = $.extend({}, this.account, ret.data);
                        //刷新本页面的数据
                    } else {
                        IOT.tips(ret.message || '服务器请求失败，稍后再试！', 'error');
                    }
                });
            }
        },
        mounted: function () {
            this.$nextTick(() => {
                
            });
        }
    });
})();